<#include '/admin/header.html' > <#assign
dateFormat="com.enation.framework.directive.DateformateDirective"?new()>
<div class="main">
	<#if !state??>
	<div class="buttonArea">
		<span style="float: right;"> 
			<span id="simpleSearch">
				<a href="javascript:void(0)" class="button b_fr" 
				data-options="plain:true" onclick="searchKeyword()">筛选</a>
				<select id="returnState" style="height: 28px;margin-right:10px;margin-top: 1px;">
					<option value="">请选择</option>
					<option value="0">新建</option>
					<option value="1">待入库</option>
					<option value="4">已入库</option>
					<option value="6">已退款</option>
					<option value="2">已取消</option>
					<option value="5">部分入库</option>
				</select> 
			</span>
		</span>
	</div>
	</#if>
	<div class="shadowBoxWhite tableDiv">
		<table id="orderReturndata" class="easyui-datagrid"
			data-options="url:'${ctx}/shop/admin/order-report/returned-list-json.do?type=2',pageList: [10,15,20,30],pageSize:${pageSize},fitColumns:'true'"
			pagination="true" width="width">
			<thead>
				<tr>
					<th data-options="field:'id',width:35">退货ID</th>
					<th data-options="field:'tradeno',width:100">退货单号</th>
					<th data-options="field:'tradestatus',width:100" formatter="formatType">退货状态</th>
					<th data-options="field:'ordersn',width:100">退货订单号</th>
					<th data-options="field:'regoperator',width:100">业务员</th>
					<th data-options="field:'regtime',width:100" formatter="formatTime">操作时间</th>
					<th data-options="field:'apply_alltotal',width:100">申请退货金额</th>
					<th data-options="field:'action',width:50,align:'center'" formatter="formatOperation">操作</th>
				</tr>
			</thead>
		</table>
		<div id="pay_detail"></div>
	</div>
</div>
<script type="text/javascript">
	function formatType(value, row, index) {
		var val;
		if (value == 0) {
			val = "新建";
		}
		if (value == 1) {
			val = "审核通过待入库";
		}
		if (value == 2) {
			val = "已取消";
		}
		if (value == 6) {
			val = "已退款";
		}
		if (value == 4) {
			val = "已入库";
		}
		if (value == 5) {
			val = "部分入库";
		}
		
		return val;
	}

	function formatTime(value, row, index) {
		return getFormatDateByLong(value, "yyyy-MM-dd hh:mm:ss");
	}
	function formatOperation(value, row, index) {
		var val;
		if(row.tradestatus==0){
			val = "<a href='javascript:void(0);' onclick=newTab('退货单审核','${ctx}/shop/admin/sell-back/auth.do?id="+row.id+"'); >查看</a>";
		}else{
			val = "<a href='javascript:void(0);' onclick=newTab('退货入库','${ctx}/shop/admin/sell-back/returned.do?id="+row.id+"'); >查看</a>";
		}
		return val;
	}
	
	//定义一个刷新datagrid的方法，将其保存到window.top中
	window.top["reload_Abnormal_Monitor"]=function(){
        $("#orderReturndata").datagrid("reload");
    };
    
  	//筛选退货单 add by DMRain 2016-4-28
    function searchKeyword(){
   	var returnState = $("#returnState").val();

   	$("#orderReturndata").datagrid('load', {
   		state:returnState
       });
    }
    
</script>
<div id="log"></div>

<#include '/admin/footer.html' >